package com.picturewatermark.util;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.image.BufferedImage;

public class BufferedImageConverter {
	public static BufferedImage getBufferedImage(Image picture) {
		int width = picture.getWidth(null);
		int height = picture.getHeight(null);
		BufferedImage bpicture = new BufferedImage(width, height,
				BufferedImage.TYPE_INT_ARGB);
		Graphics bpG = bpicture.getGraphics();
		boolean imageDrawn = false;
		do {
			imageDrawn = bpG.drawImage(picture, 0, 0, null);
		} while (imageDrawn == false);
		bpG.dispose();
		return bpicture;
	}
}
